const { defineConfig } = require('@vue/cli-service');
const { default: AutoImport } = require('unplugin-auto-import/webpack');
const { default: Components } = require('unplugin-vue-components/webpack');
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers');
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 6161, 
    proxy: {
      '/api': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '', // 移除请求路径中的 /api 前缀
        },
        logLevel: 'info',  // 尝试更高的日志级别
      },
      '/images': {
        target: 'http://localhost:8080',
        changeOrigin: true,
      },
      '/public': {
        target: 'http://localhost:8080',
        changeOrigin: true,
      }
    },
  },
  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
  },
});
